<?php
class Contact extends CI_Controller
{
	function __construct(){
		parent::__construct();
		// autoload helper and library
		$this->load->model('contact_model');
		$this->layout->setLayout('admin');
		$auth = $this->session->userdata('auth');
		if(!$auth)
		{
			redirect('/auth/login');
		}
	}
	function index(){
		$data['contact'] = $this->contact_model->getContact();
		$this->layout->view('contact',$data);
	}
	function update()
	{
		$id = $this->input->post('hidID');
		$content = $this->input->post('content');
		$mail = $this->input->post('mail');
		$contact = array('id'=>$id,'content'=>$content,'mail'=>$mail);
		$this->contact_model->update($contact);
		redirect('contact');
	}
}